package com.faithnmn.learnenglish;

import java.io.IOException;
import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import se.emilsjolander.stickylistheaders.StickyListHeadersListView;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.widget.DrawerLayout;
import android.text.Html;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.DecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.VolleyError;
import com.faithnmn.learnenglish.adapter.StableArrayAdapter;
import com.faithnmn.learnenglish.adapter.StickyListHeaderAdapter;
import com.faithnmn.learnenglish.db.DataBaseHelper;
import com.faithnmn.learnenglish.listeners.FeedsListener;
import com.faithnmn.learnenglish.listeners.SharePostListener;
import com.faithnmn.learnenglish.model.Quote;
import com.faithnmn.learnenglish.network.NetworkExecutor;
import com.faithnmn.learnenglish.service.FeedReceiver;
import com.faithnmn.learnenglish.service.FeedService;
import com.faithnmn.learnenglish.util.CommonUtil;
import com.faithnmn.learnenglish.util.Utils;
import com.faithnmn.learnenglish.view.CustomProgressDialog;
import com.faithnmn.utils.NotificationsHelper;
import com.faithnmn.utils.WeatherHelper;
import com.faithnmn.utils.weather.GotWeatherCallback;
import com.faithnmn.utils.weather.WeatherUtil;
import com.faithnmn.utils.weather.model.Weather;
import com.gc.materialdesign.views.ButtonFlat;
import com.gc.materialdesign.widgets.Dialog;
import com.google.analytics.tracking.android.EasyTracker;
import com.google.analytics.tracking.android.Fields;
import com.google.analytics.tracking.android.MapBuilder;
import com.ikimuhendis.ldrawer.DrawerArrowDrawable;

import fr.castorflex.android.smoothprogressbar.SmoothProgressBar;

public class MainActivity extends SherlockFragmentActivity implements OnItemClickListener{


	private NetworkExecutor networkExecutor;
	private static CustomProgressDialog loadingBar;
	private static SmoothProgressBar loadingWeatherBar;
	private static DataBaseHelper dbHelper;
	private static int start = 0;
	private static ArrayList<Quote> list = new ArrayList<Quote>();
	private static TextView pageNo;
	private static String contentValue="";
	private static int totalPages = 0;
	private static StickyListHeadersListView stickyList;
	private StickyListHeaderAdapter mAdapter;
	private DrawerLayout mDrawerLayout;
	private ListView leftMenu;
	private ActionBarDrawerToggle menuToggle;
	private com.ikimuhendis.ldrawer.ActionBarDrawerToggle menuToggleNew;
	private DrawerArrowDrawable drawerArrow;
	private TextView location;
	private TextView temperature;
	private TextView weatherDescription;
	private String[] values = new String[] { "Android"};
	private WeatherHelper weatherHelper;
	private GotWeatherCallback weatherCallback;
	private TextView updateTime;
	private FeedReceiver feedReceiver;
	private FeedsListener feedsListener;
	private int actionbarHeight = 49;
	private SharePostListener sharePostListener;
	private int currentPage = 1;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
//		if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
//			getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
//		}
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		getSupportActionBar().setHomeButtonEnabled(true);
		getSupportActionBar().setIcon(android.R.color.transparent);
		getSupportActionBar().setDisplayUseLogoEnabled(false);
		setContentView(R.layout.activity_main);
		EasyTracker easyTracker = EasyTracker.getInstance(this);
		easyTracker.send(MapBuilder
				  .createAppView()
				  .set(Fields.SCREEN_NAME, "Main Screen")
				  .build()
		);
		NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
		mNotificationManager.cancelAll();
		easyTracker.send(MapBuilder.createEvent("UI", "OPEN APP", "Main Screen", Long.valueOf(1)).build());
		// set up the drawer's list view with items and click listener
		mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
		leftMenu = (ListView) findViewById(R.id.left_menu_layout);
		View weatherHeader = getLayoutInflater().inflate(R.layout.weather_header_layout, null);
		location = (TextView)weatherHeader.findViewById(R.id.location);
		updateTime = (TextView)weatherHeader.findViewById(R.id.updateTime);
		temperature = (TextView)weatherHeader.findViewById(R.id.temperature);
		weatherDescription = (TextView)weatherHeader.findViewById(R.id.weatherDescription);
		loadingWeatherBar = (SmoothProgressBar)weatherHeader.findViewById(R.id.loadingBar);
		DecelerateInterpolator interpolator = new DecelerateInterpolator(0.2f);
		loadingWeatherBar.setSmoothProgressDrawableSpeed(0.2f);
		loadingWeatherBar.setSmoothProgressDrawableProgressiveStartSpeed(0.2f);
		loadingWeatherBar.setSmoothProgressDrawableProgressiveStopSpeed(0.2f);
		loadingWeatherBar.setSmoothProgressDrawableInterpolator(interpolator);
		loadingWeatherBar.setSmoothProgressDrawableColors(getResources().getIntArray(R.array.gplus_colors));
		weatherHelper = new WeatherHelper(MainActivity.this);
        weatherCallback = new GotWeatherCallback() {
			@Override
			public void onGotWeather(final Weather weather) {
				if(weather != null){
					Log.e("onGotWeather", "Weather:"+WeatherUtil.getWeatherDescription(weather.condition_code, "VI"));
					runOnUiThread(new Runnable() {
						
						@Override
						public void run() {
							weather.updateTime = System.currentTimeMillis();
							updateWeatherView(weather);
							Utils.saveCacheWeather(MainActivity.this,weather);
						}
					});
				}
			}
		};
		Weather cached = Utils.getWeatherCache(this);
		if(cached!=null){
			updateWeatherView(cached);
		}
		 weatherHelper.getWeather(weatherCallback);
		ImageView refresh = (ImageView)weatherHeader.findViewById(R.id.refresh);
		refresh.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				//Get weather
				if(loadingWeatherBar != null && !loadingWeatherBar.isShown()){
					loadingWeatherBar.setVisibility(View.VISIBLE);
				}
				weatherHelper.getWeather(weatherCallback);
			}
		});
		leftMenu.setDivider(null);
		leftMenu.addHeaderView(weatherHeader);
		ArrayList<String> listString = new ArrayList<String>();
	    for (int i = 0; i < values.length; ++i) {
	      listString.add(values[i]);
	    }
		StableArrayAdapter adapter = new StableArrayAdapter(this,
		        android.R.layout.simple_list_item_1, listString);
		leftMenu.setOnItemClickListener(new DrawerItemClickListener());
		leftMenu.setAdapter(adapter);
		if(Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH){
			menuToggle = new ActionBarDrawerToggle(this, /* host Activity */
				mDrawerLayout, /* DrawerLayout object */
				R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
				R.string.open_leftmenu, /* "open drawer" description for accessibility */
				R.string.close_leftmenu /* "close drawer" description for accessibility */
				) {
					public void onDrawerClosed(View view) {
						
					}

					public void onDrawerOpened(View drawerView) {

					}
				};
				mDrawerLayout.setDrawerListener(menuToggle);
		}else{
			drawerArrow = new DrawerArrowDrawable(this) {
		        @Override
		        public boolean isLayoutRtl() {
		            return false;
		        }
		    };
		    menuToggleNew = new com.ikimuhendis.ldrawer.ActionBarDrawerToggle(this, mDrawerLayout,
		            drawerArrow, R.string.open_leftmenu,
		            R.string.close_leftmenu);
		    menuToggleNew.setAnimateEnabled(true);
		    mDrawerLayout.setDrawerListener(menuToggleNew);
		}
		//
		sharePostListener = new SharePostListener() {
			
			@Override
			public void onClickSharePost(int postion) {
				doSharePost(postion);
			}
		};
		mAdapter = new StickyListHeaderAdapter(this, list);
		mAdapter.setSharePostListener(sharePostListener);
		stickyList = (StickyListHeadersListView) findViewById(R.id.list);
//		stickyList.getCurrentListView().getViewTreeObserver().addOnScrollChangedListener(this);
        stickyList.setOnItemClickListener(this);
//        stickyList.setOnHeaderClickListener(this);
//        stickyList.setOnStickyHeaderChangedListener(this);
//        stickyList.setOnStickyHeaderOffsetChangedListener(this);
        stickyList.setDrawingListUnderStickyHeader(true);
        stickyList.setAreHeadersSticky(true);
        stickyList.setAdapter(mAdapter);
		//
		pageNo = (TextView) findViewById(R.id.pageNo);
		loadingBar  = new CustomProgressDialog(Utils.convertDPToPixels(this, 20),this);
		loadingBar.setCancelable(false);
		loadingBar.setMessage("Loading..");
		loadingBar.show();
		networkExecutor = NetworkExecutor.getInstance().init(this);
		dbHelper = new DataBaseHelper(MainActivity.this);
		try {
			dbHelper.createDataBase();
			totalPages = dbHelper.getQuoteCount() / 10;
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		ButtonFlat get = (ButtonFlat) findViewById(R.id.helloButton);
		get.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				loadingBar.show();
				networkExecutor.getPagePostStatus(3000, new Listener<JSONObject>() {

					@Override
					public void onResponse(JSONObject response, String extraData) {
						if(loadingBar != null && loadingBar.isShowing()){
							loadingBar.dismiss();
						}
						Log.e("Response Success", response == null?"Response NULL":response.toString());
						Toast.makeText(MainActivity.this, "Succeeded! Prepare to write db",Toast.LENGTH_LONG).show();
						ArrayList<Quote> quotes = new ArrayList<Quote>();
						try {
							JSONArray arr = response.getJSONArray("data");
							Quote quote;
							JSONObject jsonObj;
							for(int i=0;i<arr.length();i++){
								jsonObj = arr.getJSONObject(i);
								quote = new Quote(jsonObj.getString("post_id"), jsonObj.getString("created_time"), jsonObj.getString("message"));
								quotes.add(quote);
							}
							dbHelper.insertQuotes(quotes);
						} catch (JSONException e) {
							e.printStackTrace();
						}
						
						Toast.makeText(MainActivity.this, "Succeeded! Writed to file",Toast.LENGTH_LONG).show();
					}
				}, new ErrorListener() {

					@Override
					public void onErrorResponse(VolleyError error, String extraData) {
						if(loadingBar != null && loadingBar.isShowing()){
							loadingBar.dismiss();
						}
						Log.e("Response Error", error.getMessage() == null?"Error,try again":error.getMessage());
						Toast.makeText(MainActivity.this, "Error, try again",Toast.LENGTH_LONG).show();
					}
				});
			}
		});
		pageNo.setText("Trang: 1 / "+totalPages);
		new GetQuoteAsynTask(true,true).execute();
		Intent fService = new Intent(this,FeedService.class);
		startService(fService);
		feedsListener = new FeedsListener() {
			
			@Override
			public void onReceiveFeeds(ArrayList<String> updateList) {
				refreshWithNewFeeds(updateList);
			}
		};
		feedReceiver = new FeedReceiver(feedsListener);
		LocalBroadcastManager.getInstance(this).registerReceiver(feedReceiver, new IntentFilter(FeedReceiver.ACTION));
//		handle.post(getActionBarSize);
	}
	
	private Handler handle = new Handler();
	
	private Runnable getActionBarSize = new Runnable() {
		
		@Override
		public void run() {
			if(getSupportActionBar().getHeight() == 0){
				handle.postDelayed(this, 1000);
				return;
			}
			if(actionbarHeight == 49){
				actionbarHeight = getSupportActionBar().getHeight();
			}
			if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
				stickyList.getCurrentListView().setPadding(0, actionbarHeight, 0, Utils.convertDPToPixels(MainActivity.this, 16));
			}
		}
	};
	
	@Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        // Sync the toggle state after onRestoreInstanceState has occurred.
        if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
        	menuToggle.syncState();
        }else{
        	menuToggleNew.syncState();
        }
    }

	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
//		// ActionBarDrawerToggle will take care of this.
//		if(menuToggle == null && menuToggleNew != null){
//			if (menuToggleNew.onOptionsItemSelected(getMenuItem(item))) {
//				return true;
//			}
//
//		}else if(menuToggle != null){
//			if (menuToggle.onOptionsItemSelected(getMenuItem(item))) {
//				return true;
//			}
//
//		}
		// Handle action buttons
		switch (item.getItemId()) {
		case android.R.id.home:
			if (mDrawerLayout.isDrawerOpen(Gravity.START)) {
				mDrawerLayout.closeDrawer(Gravity.START);
			} else {
				mDrawerLayout.openDrawer(Gravity.START);
			}
			if (mDrawerLayout.isDrawerOpen(Gravity.END)) {
				mDrawerLayout.closeDrawer(Gravity.END);
			}
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}
	
	/* The click listner for ListView in the navigation drawer */
	private class DrawerItemClickListener implements ListView.OnItemClickListener {
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			selectLeftMenuItem(position);
		}
	}
	
	private void selectLeftMenuItem(int position) {
		leftMenu.setItemChecked(position, true);
		// setTitle(menuTITLes[position]);
		mDrawerLayout.closeDrawer(leftMenu);
	}
	
	public  void refreshWithNewFeeds(ArrayList<String> updateList){
		if(stickyList == null){
			NotificationsHelper helper = new NotificationsHelper(this, MainActivity.class, R.drawable.ic_launcher, R.drawable.ic_launcher, 2112);
			helper.setTitle(getResources().getString(R.string.update_post_title)).setContent(getResources().getString(R.string.update_post_content, updateList.size()));
			helper.setSumaryTitleInbox(getString(R.string.update_post_summary_title)).setBigContentTitleInbox(getResources().getString(R.string.update_post_big_title));
			helper.showInboxStyle(updateList);
			return;
		}
		if(loadingBar != null && !loadingBar.isShowing()){
			loadingBar.show();
		}
		totalPages = dbHelper.getQuoteCount() / 10;
		new RefreshQuoteAsynTask().execute();
	}
	
	@Override
	  public void onStart() {
	    super.onStart();
	    EasyTracker.getInstance(this).activityStart(this);
	  }

	  @Override
	  public void onStop() {
	    super.onStop();
	    EasyTracker.getInstance(this).activityStop(this);
	  }
	
	@Override
	protected void onResume() {
		super.onResume();
		if(loadingBar != null && loadingBar.isShowing()){
			loadingBar.dismiss();
		}
	}
	  
	@Override
	protected void onDestroy() {
		stickyList = null;
		try {
			LocalBroadcastManager.getInstance(this).unregisterReceiver(feedReceiver);
		} catch (Exception e) {
		}
		handle.removeCallbacks(getActionBarSize);
		super.onDestroy();
	}
	
	public void getQuotes(View view){
		currentPage +=1;
		pageNo.setText("Trang "+currentPage+ " / "+totalPages);
		EasyTracker.getInstance(this).send(MapBuilder.createEvent("UI", "Click Next Page", "Current Post:"+pageNo.getText(), Long.valueOf(1)).build());
		if(loadingBar != null && !loadingBar.isShowing()){
			loadingBar.show();
		}
		Thread getThread  = new Thread(new Runnable() {
			
			@Override
			public void run() {
				new GetQuoteAsynTask(true,false).execute();
			}
		});
		getThread.start();
	}
	
	private class GetQuoteAsynTask extends AsyncTask<Void, Void, String>{
		
		boolean isNext = true;
		boolean firstStart = false;
		public GetQuoteAsynTask(boolean isNext,boolean firstStart){
			this.isNext = isNext;
			this.firstStart = firstStart;
		}
		
		@Override
		protected void onPreExecute() {
			runOnUiThread(new Runnable() {
				
				@Override
				public void run() {
//					Log.e("getQuoteAsyn","start:"+start+", totalPages:"+totalPages);
//					if(firstStart){
//						pageNo.setText("Trang: 1 / "+totalPages);
//						return;
//					}
//					if (start == 0 && !isNext) {
//						pageNo.setText("Trang: 1 / "+totalPages);
//					} else {
//						pageNo.setText("Trang: " + (isNext ? ((start + 10) / 10) : ((start - 10) / 10))+"/ "+totalPages);
//					}
				}
			});
			
		}
		
		@Override
		protected String doInBackground(Void... params) {
			if(firstStart){
				list = dbHelper.getQuotes(start);
			}else{
				if(start == 0 && !isNext){
					return null;
				}
				if(isNext){
						start +=10;
						list = dbHelper.getQuotes(start);
				}else{
					if(start == 0){
						return null;
					}
					start -=10;
					list = dbHelper.getQuotes(start);
				}
			}
			return "normal";
		}
		
		@Override
		protected void onPostExecute(String result) {
			if(list != null && list.size()>0 && result!= null){
				for (Quote quote : list) {
//					if(contentValue == null){
//						contentValue ="";
//					}
//					Log.e("Print", quote.created_time +" - "+CommonUtil.convertFBUnixtime(quote.created_time));
//					contentValue +="<b>"+CommonUtil.convertFBUnixtime(quote.created_time)+"</b><br>"+quote.message.replace("\n", "<br>")+"<br>";
				}
			}else if(result == null){
				if(isNext){
					currentPage -=1;
				}else{
					currentPage +=1;
				}
				pageNo.setText("Trang "+currentPage+ " / "+totalPages);
				Toast.makeText(MainActivity.this, "Reach first page!",Toast.LENGTH_LONG).show();
			}
			runOnUiThread(new Runnable() {
				
				@Override
				public void run() {
					if(list != null){
						mAdapter.setDatas(list);
//						stickyList.smoothScrollToPosition(0);
						stickyList.setDrawingListUnderStickyHeader(true);
				        stickyList.setAreHeadersSticky(true);
				        stickyList.setAdapter(mAdapter);
						if(loadingBar != null && loadingBar.isShowing()){
							loadingBar.dismiss();
						}
					}
				}
			});
		}
		
	}
	
	private  class RefreshQuoteAsynTask extends AsyncTask<Void, Void, String>{
		
		public RefreshQuoteAsynTask(){
		}
		
		@Override
		protected void onPreExecute() {
			pageNo.setText("Trang: " + ((start + 10) / 10) +"/ "+totalPages);
			
		}
		
		@Override
		protected String doInBackground(Void... params) {
			list = dbHelper.getQuotes(start);
			return "normal";
		}
		
		@Override
		protected void onPostExecute(String result) {
//			if(list != null && list.size()>0 && result!= null){
//				
//				for (Quote quote : list) {
//					if(contentValue == null){
//						contentValue ="";
//					}
//					contentValue +="<b>"+CommonUtil.convertFBUnixtime(quote.created_time)+"</b><br>"+quote.message.replace("\n", "<br>")+"<br>";
//				}
//			}
//			if(contentValue != null){
//				list = null;
//				contentValue = null;
//			}
//			if(loadingBar != null && loadingBar.isShowing()){
//				loadingBar.dismiss();
//			}
			runOnUiThread(new Runnable() {
				
				@Override
				public void run() {
					if(list != null){
						mAdapter.setDatas(list);
//						stickyList.smoothScrollToPosition(0);
						stickyList.setDrawingListUnderStickyHeader(true);
				        stickyList.setAreHeadersSticky(true);
				        stickyList.setAdapter(mAdapter);
						if(loadingBar != null && loadingBar.isShowing()){
							loadingBar.dismiss();
						}
					}
				}
			});
		}
		
	}
	
	public void getPreviousQuotes(View view){
		if(currentPage == 1){
			Toast.makeText(MainActivity.this, "Reach first page!",Toast.LENGTH_LONG).show();
			return;
		}
		currentPage -=1;
		pageNo.setText("Trang "+currentPage+ " / "+totalPages);
		EasyTracker.getInstance(this).send(MapBuilder.createEvent("UI", "Click Previous Page", "Current Post:"+pageNo.getText(), Long.valueOf(1)).build());
		if(loadingBar != null && !loadingBar.isShowing()){
			loadingBar.show();
		}
		Thread getThread  = new Thread(new Runnable() {
			
			@Override
			public void run() {
				new GetQuoteAsynTask(false,false).execute();
			}
		});
		getThread.start();
	}

	@Override
	public void onItemClick(AdapterView<?> adapterView, View arg1, final int position, long arg3) {
		if(mAdapter.getTitleHeaders().length>position && list!= null){
			Dialog dialog = new Dialog(this, mAdapter.getTitleHeaders()[position], list.get(position).message,true,"Close","Share");
			dialog.setOnAcceptButtonClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
				}
			});
			dialog.setOnCancelButtonClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					doSharePost(position);
				}
			});
			dialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
			dialog.show();
		}
	}

	private void shareIt(int position){
		Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
		sharingIntent.setType("text/plain");
		sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.share_title));
		sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, list.get(position).message);
		startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_title)));
	}

	private void updateWeatherView(Weather weather) {
		if(loadingWeatherBar!= null && loadingWeatherBar.isShown()){
			loadingWeatherBar.setVisibility(View.GONE);
		}
		location.setText(weather.getCity());
		temperature.setText(weather.getTemp()+"\u00B0"+weather.unit_temp);
		updateTime.setText(CommonUtil.getPrettyTime(weather.updateTime));
		weatherDescription.setText(WeatherUtil.getWeatherDescription(weather.condition_code, "VI"));
	}


	private void doSharePost(int position) {
		Log.e("ClickShare",Html.fromHtml(mAdapter.getTitleHeaders()[position]).toString());
		if(loadingBar != null && !loadingBar.isShowing()){
			loadingBar.show();
		}
		EasyTracker.getInstance(MainActivity.this).send(MapBuilder.createEvent("UI", "Click Share Button", Html.fromHtml(mAdapter.getTitleHeaders()[position]).toString(), Long.valueOf(1)).build());
		shareIt(position);
	}

    
//	@Override
//	public void onScrollChanged() {
//		float y = stickyList.getCurrentListView().getScrollY();
//		Log.e("onScrollChanged","actionBarHeight:"+actionbarHeight+",y:"+y);
//		if (y >= actionbarHeight && getSupportActionBar().isShowing()) {
//			getSupportActionBar().hide();
//		} else if ( y==0 && !getSupportActionBar().isShowing()) {
//			getSupportActionBar().show();
//		}
//	}
	
}
